import request from '@/utils/request'
// 创建抽签
export function createLottery(data) {
	return request({
		'url': '/activity/activityDraw/createLottery',
		headers: {
			isToken: true
		},
		'method': 'post',
		'data': data
	})
}
// 创建投票
export function createPoll(data) {
	return request({
		'url': '/activity/activityPoll/createPoll',
		headers: {
			isToken: true
		},
		'method': 'post',
		'data': data
	})
}
//获取投票结果信息 
export function VoteResult(data) {
	return request({
		'url': '/activity/activityPoll/pollResult',
		'method': 'get',
        data
	})
}
//获取抽签结果信息 
export function DrawResult(data) {
	return request({
		'url': '/activity/activityDraw/drawingResult',
		'method': 'get',
        data
	})
}

// 获取参与投票页面信息
export function getVoteInfo(pollId) {
	return request({
		'url': '/activity/activityPoll/pollResult?pollId=' + pollId,
		'method': 'get'
	})
}
// 获取参与抽签页面信息 
export function getDrawInfo(drawId) {
	return request({
		'url': '/activity/activityDraw/drawRecords?drawId=' + drawId,
		'method': 'get'
	})
}
// 参与投票
export function joinVote(data) {
	return request({
		'url': `/activity/activityPoll/participationPoll?pollId=${data.pollId}&polloptionIds=${data.polloptionIds}`,
		'method': 'get'
	})
}

// 参与抽签
export function joinDraw(data) {
	return request({
		'url': `/activity/activityDraw/participationDraw`,
		'method': 'get',
        data
	})
}

// 首页我参与的投票
export function involvedVote() {
	return request({
		'url': '/activity/activityDrawPoll/myParticipating',
		'method': 'get'
	})
}

// 首页已结束的投票
export function endVote() {
	return request({
		'url': '/activity/activityDrawPoll/ended',
		'method': 'get'
	})
}

// 首页我发起的投票
export function startVote() {
	return request({
		'url': '/activity/activityDrawPoll/myInitiated',
		headers: {
			isToken: true
		},
		'method': 'get'
	})
}

